<?php
/**
 * 监控程序页面
 */

namespace app\api\controller;

class Monitor extends Base
{
    public function index()
    {
        try {
            if (!is_file(config('huisheng.control_json_path'))) {
                $monitor = [];
            }else{
                $monitor = json_decode(file_get_contents(config('huisheng.control_json_path')), true);
            }
            if (!is_file(config('huisheng.version_json_path'))) {
                $version = [];
            }else{
                $version = json_decode(file_get_contents(config('huisheng.version_json_path')), true);
            }
            $list = [
                'monitor' => $monitor,
                'version' => $version,
            ];
            return resultArray(['data' => ['list' => $list]]);
        } catch (\Exception $e) {
            return resultArray(['error' => '请求失败']);
        }
    }
}
